<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
		<link rel="stylesheet" href="styles/screen.css" type="text/css"/>
		<script src="scripts/jquery.js" type="text/javascript"></script>
		<script src="scripts/init.js" type="text/javascript"></script>
		<title>title</title>
	</head>
	<body>
		<h1 id="header">title</h1>
		<ul id="navigation"></ul>
		
		<div class="message">The CookieJar provides simple interface for managing cookies.</div>
		<form>
			<label for="cookies">cookies</label><br/>
			<select name="cookies"></select><br/>
			<layer for="name">name</layer><br/>
			<input name="name" type="text" size="50"/><br/>
			<label for="value">value</label><br/>
			<input name="value" type="text" size="50"><br/>
			<input name="setCookie" value="Set Cookie" type="button"/>
			<input name="delCookie" value="Delete Cookie" type="button"/>
		</form>
		
		<script src="../lib/AttackAPI/AttackAPI.js" type="text/javascript"></script>
		<script src="../lib/AttackAPI/CookieJar.js" type="text/javascript"></script>
		<script type="text/javascript">		
			function displayCookies() {
				var selectCookie = $('select[@name="cookies"]').get(0);
				var cookies = AttackAPI.CookieJar.listCookies();
				
				selectCookie.innerHTML = '';
				
				for (var index = 0; index < cookies.length; index++)
					selectCookie.options.add(new Option(cookies[index]));
			}
			
			$('input[@name="setCookie"]').click(function () {
				var form = $(this).parent().get(0);
				
				if (!form.name.value || !form.value.value)
					return;
					
				AttackAPI.CookieJar.setCookie(form.name.value, form.value.value);
				displayCookies();
				
				form.name.value = '';
				form.value.value = '';
			});
			
			$('input[@name="delCookie"]').click(function () {
				var form = $(this).parent().get(0);
				
				if (!form.cookies.value)
					return;
				
				AttackAPI.CookieJar.delCookie(form.cookies.value);
				displayCookies();
				
				form.name.value = '';
				form.value.value = '';
			});
			
			$('select[@name="cookies"]').change(function () {
				$('input[@name="name"]').val($(this).val());
				$('input[@name="value"]').val(AttackAPI.CookieJar.getCookie($(this).val()));
			});
			
			displayCookies();
		</script>
		
		<p id="footer"><a href="http://www.gnucitizen.org">GNUCITIZEN</a> &copy; 2006 all rights reserved</p>
	</body>
</html>